import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter as Router, Route } from 'react-router-dom';
import { asyncComponent } from 'react-async-component';
import { Tools, Toast, Bubble } from 'weaver-mobile';
import './style';

const coms = {
  Main: asyncComponent({
    resolve: () => import('./components/main')
  }),
  Portal: asyncComponent({
    resolve: () => import('./components/portal')
  })
};

class Root extends React.Component {
  render() {
    return (
      <Router>
        <Route
          name="main"
          path="/"
          render={() => {
            return (
              <coms.Main>
                <Route name="portal" path="/portal/:hpid/:subCompanyId" component={coms.Portal} />
              </coms.Main>
            );
          }}
        />
      </Router>
    );
  }
}

Tools.getLocaleLabel('portal', () => {
  ReactDOM.render(<Root />, document.getElementById('root'));
});
